<?php 
    include 'admin/class/database.php';
    $pdo = Database::connect();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script type="text/javascript">id=10</script>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<?php include 'header.php'; ?>
		<div class="content">
			<div class="conteudo conteudo-cafe-journal">
				<div class="wrapper-blog">
					<h2>ACONTECE NO CAFÉ JOURNAL</h2>
                    <?php $sql = 'SELECT * FROM posts ORDER BY id DESC';  foreach ($pdo->query($sql) as $row): ?>
                    <a href="post.php?id=<?php echo $row['id']?>" class="link-post">
                    <div class="post">
                        <div class="head-post">
                            <h2><?php echo $row['titulo_post']; ?> </h2>
                            <p><?php echo $row['data_post']; ?></p>
                        </div>
                        <div class="body-post">
                        	<center><?php echo "<img style='height:300px;' src='admin/img/uploads/".$row['foto']."' />"?></center>
                            <p><?php echo substr($row['corpo_post'], 0, 345 ), '... <br /><br /><b>Ver Post Completo <i class="fa fa-chevron-circle-right"></i></b>'; ?></p>                   
                        </div>
                        <hr />                        
                    </div><!--/.posts-->
                    </a>
                    <?php endforeach; ?>
                    
				</div><!--/wrapper-content-cafe-journal-->
                
				<div class="sidebar-blog">
                	<div class="sidebar-blog-box">
                    	<h2>ARQUIVO DO BLOG</h2>
                        <?php $sql = 'SELECT * FROM posts ORDER BY data_post DESC LIMIT 5';  foreach ($pdo->query($sql) as $row): ?>
                        <a href="post.php?id=<?php echo $row['id']?>" class="link-post">
                        	<p><?php echo $row['titulo_post']; ?></p>
                        </a>
                        <?php endforeach; ?>
                    </div>

                	<div class="sidebar-blog-box">
                    	<iframe src="//www.facebook.com/plugins/likebox.php?href=https://www.facebook.com/pages/Caf%C3%A9-Journal-Brasil-Oficial/204618459581973?fref=ts&amp;width=192&amp;height=358&amp;show_faces=true&amp;colorscheme=light&amp;stream=false&amp;show_border=true&amp;header=false&amp;appId=149155915258970" scrolling="no" frameborder="0" style="border:none; overflow:hidden; background-color:#FFF; width:78%; height:300px;" allowTransparency="false"></iframe>
                    </div>                    
                    	


				</div><!--/wrapper-img-cafe-journal-->
				<span class="clear"></span>
			</div><!--/conteudo-home-->
			<span class="clear"></span>
		</div><!--/content-->
		<span class="clear"></span>
	</div><!--/wrap-->
<?php include 'footer.php'; ?>